package com.agileai.crm.controller.procustomer;

import java.util.List;

import com.agileai.crm.bizmoduler.procustomer.LabelsTreeSelect;
import com.agileai.domain.DataParam;
import com.agileai.domain.DataRow;
import com.agileai.hotweb.controller.core.TreeSelectHandler;
import com.agileai.hotweb.domain.TreeBuilder;

public class LabelsTreeSelectHandler
        extends TreeSelectHandler {
    public LabelsTreeSelectHandler() {
        super();
        this.serviceId = buildServiceId(LabelsTreeSelect.class);
        this.isMuilSelect = true;
        this.checkRelParentNode = false;
        invisiableCheckBoxIdList.add("ORG_LABELS");
    }

    protected TreeBuilder provideTreeBuilder(DataParam param) {
        List<DataRow> records = getService().queryPickTreeRecords(param);
        TreeBuilder treeBuilder = new TreeBuilder(records, "CODE_ID",
                                                  "CODE_NAME", "TYPE_ID");
        String rootId = "ORG_LABELS";
        treeBuilder.setRootId(rootId);

        return treeBuilder;
    }

    protected LabelsTreeSelect getService() {
        return (LabelsTreeSelect) this.lookupService(this.getServiceId());
    }
}
